import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
 * 可重入锁基本使用
 */
public class ThreadLock {
    public static void main(String[] args) {
        //1.创建对象
        Lock lock=new ReentrantLock();
        //2.加锁操作
        lock.lock();
        //业务代码可能会非常复杂
        try{
            System.out.println("你好 ReentrantLock");
        }finally{
            //3.释放锁
            lock.unlock();
        }
    }
}
